package com.lkl.hystrixdemo.order.zookeeper.zkDistributeLock;

public class ZkDistributeLockImpl extends AbstractZkDistributeLock implements Runnable{
    private static int num = 0;
    @Override
    public void doAction() {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        num++;
        System.out.println(Thread.currentThread().getName() + "，执行完了业务逻辑，" + num);
    }

    @Override
    public void run() {
        super.getLock();
    }

    /**
     * 测试
     * @param args
     */
    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            Thread thread = new Thread(new ZkDistributeLockImpl());
            thread.start();
        }

    }
}
